package com.csun.cmny.provider.service.impl;

import com.csun.cmny.core.support.BaseService;
import com.csun.cmny.provider.dao.OmcServiceOrderCarelogMapper;
import com.csun.cmny.provider.dto.OmcRemoteCareLogDto;
import com.csun.cmny.provider.model.domain.OmcServiceOrderCarelog;
import com.csun.cmny.provider.service.OmcServiceOrderCarelogService;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
@Transactional
public class OmcServiceOrderCarelogServiceImpl extends BaseService<OmcServiceOrderCarelog> implements OmcServiceOrderCarelogService {

    @Resource
    private OmcServiceOrderCarelogMapper omcServiceOrderCarelogMapper;

    @Override
    public PageInfo listPage(Long orderId) {
        List<OmcServiceOrderCarelog> list=omcServiceOrderCarelogMapper.listPage(orderId);
        return new PageInfo<>(list);
    }

    @Override
    public Integer saveRemoteCareLog(OmcRemoteCareLogDto omcRemoteCareLogDto) {
        OmcServiceOrderCarelog omcServiceOrderCarelog = new OmcServiceOrderCarelog();
        BeanUtils.copyProperties(omcRemoteCareLogDto,omcServiceOrderCarelog);
        return omcServiceOrderCarelogMapper.insertSelective(omcServiceOrderCarelog);
    }
}
